package cz.semjobKB.conllx.api.impl;

import cz.semjobKB.conllx.node.EConstituent;
import cz.semjobKB.conllx.node.EWordType;
import cz.semjobKB.conllx.node.ILinguisticWord;

import java.io.Serializable;

/**
 * Interface for unifying ILinguisticWord and Serializable
 */
public class LinguisticWord implements ILinguisticWord, Serializable {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = -6258093657335025002L;

	/** The word text */
	private String _word;

	/** The word lemma. */
	private final String _lemma;
	
	/** The constituent */
	private final EConstituent _constituent;
	
	/** Parent node in a sentence parsing tree */ 
	private final short _parentNode;
	
	private final Morpho _morphology;
	
	private final boolean isLeftValence;


    /**
     * Instantiates a new linguistic word.
      * @param _word word textual representation
     * @param _lemma word lemma
     * @param _constituent word constituent
     * @param _parentNode position of the parent node in the sentence
     * @param morph morphological information
     * @param isLeft true if the word is before the parent, false if is behind him in the sentence
     */
	public LinguisticWord(String _word, final String _lemma, 
			final EConstituent _constituent, final short _parentNode, 
			final Morpho morph, final boolean isLeft) {
		super();
		this._word = _word;
		this._lemma = _lemma;		
		this._constituent = _constituent;
		this._parentNode = _parentNode;
		this._morphology = morph;
		this.isLeftValence = isLeft;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cz.semjobKB.linguistic.api.node.ILinguisticWord#getText()
	 */
	public String getText() {
		return _word;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cz.semjobKB.linguistic.api.node.ILinguisticWord#getLemma()
	 */
	public String getLemma() {
		return _lemma;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see cz.semjobKB.linguistic.api.node.ILinguisticWord#getConstituent()
	 */
	public EConstituent getConstituent() {
		return _constituent;
	}

	public short getParentNode() {
		return _parentNode;
	}

	
	public EWordType getWordType() {
		return _morphology.getWordType();
	}

	
	public char getGenus() {
		return _morphology.getGenus();
	}

	
	public char getNumber() {
		return _morphology.getNumber();
	}

	
	public char getFall() {
		return _morphology.getFall();
	}

	
	public char getPerson() {
		return _morphology.getPerson();
	}

	
	public boolean isLeftValence() {
		return isLeftValence;
	}
	
	
	public void setText(String text) {
		this._word = text;
	}
}
